package com.czy.contorller.common;

import com.czy.service.UserService;
import com.czy.dto.LoginDto;
import com.czy.result.Result;
import com.czy.vo.LoginVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
public class LoginController {
    @Autowired
    private UserService userService;

    @PostMapping("/login")
    public Result<LoginVo> login(@RequestBody LoginDto loginDto) {
        log.info("登录 {}" ,loginDto);
        LoginVo loginVo = userService.login(loginDto);

        return Result.success(loginVo);
    }
}
